public class Test {
    public class StackExample2 {
        public static void main(String[] args) {
            MyStack stack = new MyStack(5);

            // 入栈操作
            stack.push(1);
            stack.push(2);
            stack.push(3);

            // 输出栈顶元素
            System.out.println("栈顶元素: " + stack.peek());

            // 出栈操作
            int popped = stack.pop();
            System.out.println("出栈元素: " + popped);

            // 输出栈的大小
            System.out.println("栈的大小: " + stack.size());

            // 检查栈是否为空
            System.out.println("栈是否为空: " + stack.isEmpty());
        }
    }
}
